<template>
  <div id="app">
    <router-view></router-view>
    <div :class="s['u-clear']" @click="clear()">清空重来</div>
  </div>
</template>

<script>
  import localstorage from 'store'
  export default {
    name: 'app',
    methods: {
      clear() {
        localstorage.remove('userInfo');
        localstorage.remove('scoreInfo');

        this.$router.push('/');

        //数据库openid是唯一值，删除数据库里的该条记录，否则提交会失败
        // const query = this.bmob.Query('member');
        // query.equalTo("openid", "==", localstorage.get('weixinInfo')?localstorage.get('weixinInfo').openid:'o_mrTw-NE6DaeolYGOyePOuwZjkg');
        // query.find().then(res => {
        //   // 返回成功
        //   if(res.length>0) {
        //     return query.destroy(res[0].objectId)
        //   }
        // }).then(console.log)
      }
    }
  }
</script>

<style module="s" lang="less">
  @import "~less/index.less";
  @import "~less/base.less";
  html, body {
    height: 100%;
  }
  body {
    background: #E03A0E linear-gradient(#FF9638, #E03A0E) no-repeat;
  }
  .u-clear {
    position: absolute;
    right:0;
    bottom: 0;
    color: transparent;
  }
</style>
